<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>list dokumen admin</title>
        <link href="../../script/seminar.css" rel="stylesheet"/>
        <script type="text/javascript">
            function fnLogOut() {
                document.listDokumenAdminForm.method = 'POST';
                document.listDokumenAdminForm.action = '../../logic/logout.php';
                document.listDokumenAdminForm.submit();
            }
            function fnChangeList() {
                var vSlctIdx = document.listDokumenAdminForm.slctTopik.selectedIndex;
                var vTopikId = document.listDokumenAdminForm.slctTopik[vSlctIdx].value;
                document.listDokumenAdminForm.hidTopikId.value = vTopikId;
                document.listDokumenAdminForm.method = 'POST';
                document.listDokumenAdminForm.action = '../../logic/getTopListDokumen.php';
                document.listDokumenAdminForm.submit();
            }
            function fnSendSms(vNum,vKode,vNoHp) {
                var vJudul = document.getElementById('hidJudulPaper_'+vNum).value;
                var vWinH = document.body.offsetHeight;
                var vWinW = document.body.offsetWidth;
                var vPopupH = 300;
                var vPopupW = 630;
                var vPosTop = (vWinH-vPopupH)/2;
                var vPosLeft = (vWinW-vPopupW)/2;
                var vURL = "smsForm.php?init=1&kodeSms=" +vKode + "&noHp=" + String(vNoHp) + "&judul=" + vJudul;
                var vName = "SMS Form";
                var vSpecs = "width="+vPopupW+", height="+vPopupH+", top="+vPosTop+", left="+vPosLeft+", titlebar=no, menubar=no, status=no, resizable=no";
                window.open(vURL, vName, vSpecs);
            }
            
            function fnRefresh() {
                location.reload();
            }
        </script>
    </head>
    <body>
        <?php
        include("../../utility/connection.php");
        include("../../utility/general.php");
        include("../../model/mPaper.php");
        include("../../model/mSeminar.php");
        
        session_start();
        if (isset($_SESSION['arrResult'])) {
            $arrResult = $_SESSION['arrResult'];
        ?>
        <form name="listDokumenAdminForm" id="listDokumenAdminForm">
            <input type="hidden" name="hidTopikId" id="hidTopikId" />
        <table border="0" width="100%" height="100%">
            <tr valign="middle">
                <td align="center">
                    
                    <table width="1024" border="0" cellpadding="2" cellspacing="0">
                        <tr>
                            <td>
                                <select name="slctTopik" id="slctTopik" onchange="fnChangeList()">
                                    <option value="0">Semua&nbsp;Topik</option>
                                    <?php
                                    $topikId = '';
                                    if (isset($_SESSION['topikId'])) {
                                        $topikId = $_SESSION['topikId'];
                                    }
                                                
                                    $resultSeminar = fnSelectAllSeminar();
                                    if ($resultSeminar) {
                                        while($rowSeminar = mysql_fetch_row($resultSeminar)){
                                    ?>
                                    <option value="<?php echo $rowSeminar[0] ?>" <?php echo ($topikId == $rowSeminar[0])? 'SELECTED':'' ?>><?php echo $rowSeminar[1] ?></option>
                                    <?php
                                        }
                                    }
                                    ?>
                                </select>
                            </td>
                        </tr>
                        <tr class="tbl-body">
                            <td>
                                <table width="100%" height="100%" border="1" cellpadding="5" cellspacing="0">
                                    <tr class="tbl-header">
                                        <td rowspan="2">No</td>
                                        <td rowspan="2">Tema</td>
                                        <td width="200">Judul</td>
                                        <td width="100">Tgl&nbsp;Upload</td>
                                        <td rowspan="2">Pembicara</td>
                                        <td rowspan="2">Score</td>
                                        <td colspan="2">Keterangan</td>
                                        <td rowspan="2"></td>
                                    </tr>
                                    <tr class="tbl-header">
                                        <td width="40%" colspan="2">Ringkasan</td>
                                        <td>Pemeriksa</td>
                                        <td width="100">Tgl&nbsp;Periksa</td>
                                    </tr>
                                    <?php
                                    $resultTopList = '';
                                    if (isset($_SESSION['topListResult']))  {
                                        if (intval($topikId) > 0) {
                                            $resultTopList = fnGetTopListById($topikId);
                                        } else if (intval($topikId) == 0) {
                                            $resultTopList = fnGetTopList();
                                        }
                                    } else if ((!isset($_SESSION['topListResult'])) && (!isset($_SESSION['topikId']))) {
                                        $resultTopList = fnGetTopList();
                                    }
                                    if ($resultTopList) {
                                        $num = 1;
                                        while($rowTopList = mysql_fetch_row($resultTopList)){
                                            $tglReview = $rowTopList[6];
                                            $digitTgl = substr($tglReview,-2,2);
                                            $digitBulan = fnConvertMonth(substr($tglReview,-5,2));
                                            $digitTahun = substr($tglReview,0,4);
                                            $tglReview1 = $digitTgl.' '.$digitBulan.' '.$digitTahun;
                                            
                                            $tglUpload = $rowTopList[8];
                                            $digitTgl1 = substr($tglUpload,-2,2);
                                            $digitBulan1 = fnConvertMonth(substr($tglUpload,-5,2));
                                            $digitTahun1 = substr($tglUpload,0,4);
                                            $tglUpload1 = $digitTgl1.' '.$digitBulan1.' '.$digitTahun1;
                                            
                                            $noTelpUser = $rowTopList[9];
                                            $noTelpReviewer = $rowTopList[10];
                                    ?>
                                    <tr>
                                        <td rowspan="2"><?php echo $num ?></td>
                                        <td rowspan="2"><?php echo $rowTopList[1] ?></td>
                                        <td><?php echo $rowTopList[2] ?></td>
                                        <td align="center"><?php echo $tglUpload1 ?></td>
                                        <td rowspan="2"><?php echo $rowTopList[0] ?></td>
                                        <td rowspan="2" align="right"><?php echo $rowTopList[7] ?></td>
                                        <td colspan="2"><?php echo $rowTopList[4] ?></td>
                                        <td rowspan="2" align="center">
                                            <input style="display: none" type="text" name="hidJudulPaper_<?php echo $num ?>" id="hidJudulPaper_<?php echo $num ?>" value="<?php echo $rowTopList[2] ?>">
                                            <button type="button" style="width: 100px" name="btSmsSpeaker" id="btSmsSpeaker" onclick="fnSendSms(<?php echo $num ?>,1,'<?php echo $noTelpUser ?>')">Receipt</button><br>
                                            <button type="button" style="width: 100px" name="btSmsReviewer" id="btSmsReviewer" onclick="fnSendSms(<?php echo $num ?>,2,'<?php echo $noTelpReviewer ?>')">Notification</button>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2"><?php echo $rowTopList[3] ?></td>
                                        <td><?php echo $rowTopList[5] ?></td>
                                        <td align="center"><?php echo $tglReview1 ?></td>
                                    </tr>
                                    <?php
                                        $num = $num + 1;
                                        }
                                    }
                                    ?>
                                </table>
                            </td>
                        </tr>
                    </table>
                    
                </td>
            </tr>
            <tr valign="middle">
                <td align="center">
                    <button type="button" name="btLogOut" id="btLogOut" onclick="fnLogOut()">LogOut</button>
                </td>
            </tr>
        </table>
        </form>
        <?php
        }
        ?>
    </body>
</html>
